<!--# layout("/common/layout.html",{"jsBase":"/js/activity/activityPrize/"}){ -->

<form class="layui-form layui-form-pane" id="addForm"  lay-filter="editform" enctype="multipart/form-data" >
    <input type="hidden" name="prizeId" id="prizeId">
    <input type="hidden" name="actId" id="actId" value="${actId}">
    <br>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">奖品名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="prizeName" id="prizeName" autocomplete="off" maxlength="50" class="layui-input" lay-verify="required">
                </div>
            </div>
            <div class="layui-inline">
            <label class="layui-form-label">奖品排名</label>
				<div class="layui-input-inline">
                                <input type="text" name="prizeNo" id="prizeNo" autocomplete="off" maxlength="50" class="layui-input" lay-verify="required|number">
				</div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <label class="layui-form-label">可用标记</label>
            <div class="layui-input-inline">
                <select class="select" name="prizeStatus" id="prizeStatus"  promtion="请选择"  lay-filter="code" lay-verify="required">
                    <option value="">请选择</option>
                    <option value="1" >可用</option>
                    <option value="0" >不可用</option>
                </select>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <layui:image id="prizeImg" tagName="讲座主图" tips="图片说明"/>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">奖品描述</label>
                <div class="layui-input-block" style="width:512px;">
                    <textarea name="prizeDesc"  id="prizeDesc" placeholder="请输入" class="layui-textarea" lay-verify="" ></textarea>
                </div>
            </div>
        </div>
    </div>
    <layui:submitButtons id="addButton" />
</form>
<!--#} -->
<script>
    Common.initImage();
layui.extend({
    loading: '../../../plugins/layui_extends/loading/loading',
}).define([ 'form', 'laydate', 'table','loading','activityPrizeApi'], function(exports) {
    var form = layui.form;
    var activityPrizeApi = layui.activityPrizeApi;
    var index = layui.index;
    var isNew = true;
    <!--# if(!(isEmpty(activityPrizeJson))){  -->
    isNew = false;
    <!--# } -->
    var view = {
        init:function(){
            Lib.initGenrealForm($("#addForm"),form);
            this.initSubmit();
        },
        initSubmit:function(){
            $("#addButton").click(function(){
                // $("#addButton").hide();
                // $("#addButton-loading").show();
                // $("#addButton-loading").loading();
                form.on('submit(form)', function(){
                    activityPrizeApi.saveForm(isNew,$('#addForm'),function(){
                        parent.window.dataReload();
                        Common.info("保存成功");
                        Lib.closeFrame();
                    });
                });
            });

            $("#addButton-cancel").click(function(){
                Lib.closeFrame();
            });
        }

    }
    view.init();
    <!--# if(!(isEmpty(activityPrizeJson))){  -->
    var formJson = ${activityPrizeJson};
    form.val("editform",formJson);
    $(".image-preview").each(function() {
        $(this).attr("src",formJson[$(this).attr("id")]);
    });
    <!--# } -->
});
</script>
